package com.probox.order.api.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.probox.common.core.annotation.Excel;
import com.probox.common.core.enums.OrderTypeEnum;
import com.probox.common.core.enums.SaleStatusEnum;
import com.probox.common.core.enums.SettlementEnum;
import com.probox.common.core.utils.money.MoneyUtils;
import com.probox.common.core.utils.money.PriceFormatUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 订单明细对象 order_info_item
 *
 * @author hds
 * @date 2021-05-27
 */
@Data
@ApiModel(description = "订单明细")
public class OrderItemVo implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * ID
     */
    private Long itemUid;
    /**
     * 供应商ID
     */
    @Excel(name = "供应商ID")
    @ApiModelProperty(value = "供应商ID(供应商ID)")
    private Long supplierUid;

    /**
     * 订单id
     */
    @Excel(name = "订单id")
    @ApiModelProperty(value = "订单id(订单id)")
    private Long orderUid;

    @ApiModelProperty(value = "订单编号")
    private String orderNo;


    /**
     * 活动ID
     */
    @Excel(name = "活动ID")
    @ApiModelProperty(value = "活动ID(活动ID)")
    private Long activityUid;

    /**
     * 参与活动ID
     */
    @Excel(name = "参与活动ID")
    @ApiModelProperty(value = "参与活动ID(参与活动ID)")
    private Long activityProUid;

    /**
     * 商品ID
     */
    @Excel(name = "商品ID")
    @ApiModelProperty(value = "商品ID(商品ID)")
    private Long proUid;

    /**
     * 商品名称
     */
    @Excel(name = "商品名称")
    @ApiModelProperty(value = "商品名称(商品名称)")
    private String proName;

    @ApiModelProperty(value = "商品编号")
    private String proNo;

    @ApiModelProperty(value = "商品单位")
    private String proUnit;

    /**
     * sku属性ID
     */
    @Excel(name = "sku属性ID")
    @ApiModelProperty(value = "sku属性ID(sku属性ID)")
    private Long skuUid;

    /**
     * SKU的属性值
     */
    @Excel(name = "SKU的属性值")
    @ApiModelProperty(value = "SKU的属性值(SKU的属性值)")
    private String skuDesc;

    /**
     * 封面图
     */
    @Excel(name = "封面图")
    @ApiModelProperty(value = "封面图(封面图)")
    private String imgUrl;

    /**
     * 销售单价
     */
    @Excel(name = "销售单价")
    @ApiModelProperty(value = "销售单价(销售单价)")
    private Long price;

    /**
     * 成本价/供应商价格
     */
    @Excel(name = "成本价/供应商价格")
    @ApiModelProperty(value = "成本价/供应商价格(成本价/供应商价格)")
    private Long costPrice;

    /**
     * 展示价格
     */
    @Excel(name = "展示价格")
    @ApiModelProperty(value = "展示价格(展示价格)")
    private Long showPrice;

    /**
     * 数量
     */
    @Excel(name = "数量")
    @ApiModelProperty(value = "数量(数量)")
    private Long itemNumber;

    /**
     * 合计金额
     */
    @Excel(name = "合计金额")
    @ApiModelProperty(value = "合计金额(合计金额)")
    private Long itemAmount;

    /**
     * 现金支付金额
     */
    @Excel(name = "现金支付金额")
    @ApiModelProperty(value = "现金支付金额(现金支付金额)")
    private Long payAmount;

    /**
     * 使用优惠券的金额
     */
    @Excel(name = "使用优惠券的金额")
    @ApiModelProperty(value = "使用优惠券的金额(使用优惠券的金额)")
    private Long useCouponAmount;

    /**
     * 折扣金额(合计金额-合计金额*折扣)
     */
    @Excel(name = "折扣金额(合计金额-合计金额*折扣)")
    @ApiModelProperty(value = "折扣金额(合计金额-合计金额*折扣)(折扣金额(合计金额-合计金额*折扣))")
    private Long discountAmount;

    /**
     * 余额支付
     */
    @Excel(name = "余额支付")
    @ApiModelProperty(value = "余额支付(余额支付)")
    private Long payByBalance;

    /**
     * 积分抵扣
     */
    @Excel(name = "积分抵扣")
    @ApiModelProperty(value = "积分抵扣(积分抵扣)")
    private Long payByScore;

    /**
     * 红包支付
     */
    @Excel(name = "红包支付")
    @ApiModelProperty(value = "红包支付(红包支付)")
    private Long payByRedBag;

    public String getPayByRedBagStr() {
        return MoneyUtils.changeF2Y(payByRedBag);
    }

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "支付时间")
    private Date payTime;

    /**
     * 购物车ID
     */
    @Excel(name = "购物车ID")
    @ApiModelProperty(value = "购物车ID(购物车ID)")
    private Long cartUid;

    /**
     * 结算状态 0未结算，1已结算，2结算中
     */
    @Excel(name = "结算状态 0未结算，1已结算，2结算中")
    @ApiModelProperty(value = "结算状态 0未结算，1已结算，2结算中(结算状态 0未结算，1已结算，2结算中)")
    private String settlementStatus;

    /**
     * 结算时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "结算时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "结算时间(结算时间)")
    private Date settlementTime;

    /**
     * 售后状态(0 正常,1申请售后,2售后结束)
     */
    @Excel(name = "售后状态(0 正常,1申请售后,2售后结束)")
    @ApiModelProperty(value = "售后状态(0 正常,1申请售后,2售后结束)(售后状态(0 正常,1申请售后,2售后结束))")
    private String saleStatus;

    /**
     * 数据状态 1有效，0无效
     */
    @Excel(name = "数据状态 1有效，0无效")
    @ApiModelProperty(value = "数据状态 1有效，0无效(数据状态 1有效，0无效)")
    private String dataStatus;

    /**
     * $column.columnComment
     */
    private Long createUid;

    /**
     * $column.columnComment
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    /**
     * $column.columnComment
     */
    private Long updateUid;

    /**
     * $column.columnComment
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

    /**
     * 余额支付
     */
    @ApiModelProperty(value = "余额支付")
    private Long orderPayByBalance;

    /**
     * 晒单状态(0未晒单1已晒单)
     */
    @ApiModelProperty(value = "晒单状态(0未晒单1已晒单)")
    private String buyShow;

    /**
     * 显示晒单按钮
     *
     * @return
     */
    @ApiModelProperty(value = "显示晒单按钮(1显示0不显示)")
    private String isBuyShow;

    private String orderType;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date payDate;

    private String payStatus;

    public String getOrderTypeStr() {
        return OrderTypeEnum.getNameByKey(orderType);
    }

    public String getPriceStr() {
        return PriceFormatUtil.format(price);
    }

    public String getCostPriceStr() {
        return PriceFormatUtil.format(costPrice);
    }

    public String getShowPriceStr() {
        return PriceFormatUtil.format(showPrice);
    }

    public String getItemAmountStr() {
        return PriceFormatUtil.format(itemAmount);
    }

    public String getPayAmountStr() {
        return PriceFormatUtil.format(payAmount);
    }

    public String getDiscountAmountStr() {
        return PriceFormatUtil.format(discountAmount);
    }

    public String getUseCouponAmountStr() {
        return PriceFormatUtil.format(useCouponAmount);
    }

    public String getPayByBalanceStr() {
        return PriceFormatUtil.format(payByBalance);
    }

    public String getSettlementStatusName() {
        return SettlementEnum.getNameByKey(settlementStatus);
    }

    public String getSaleStatusName() {
        return SaleStatusEnum.getNameByKey(saleStatus);
    }

    public String getPayStatusName(){
        if (payStatus.equals("1")){
            return "已付款";
        }
        return "未付款";
    }

}
